﻿using System;
using System.Collections.Generic;
using System.Linq;
using Autodesk.Revit.DB;

namespace YJKSparseDistance.ModelLayer
{
	public class AreaCheckResultPacker
	{
		public Area ThisArea
		{
			get
			{
				return this.m_thisArea;
			}
		}

		public Level ThisLevel
		{
			get
			{
				return this.m_thisLevel;
			}
		}

		public List<ResultBean> LstErrorResult
		{
			get
			{
				return this.m_lstErrorResult;
			}
		}

		public AreaCheckResultPacker(Area inputArea, List<List<ResultBean>> input)
		{
			this.m_thisArea = inputArea;
			this.m_thisLevel = this.ThisArea.Level;
			using (List<List<ResultBean>>.Enumerator enumerator = input.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					List<ResultBean> list = (from k in enumerator.Current
					orderby k.Distance
					select k).ToList<ResultBean>();
					if (list.Count > 0 && !list[0].IfRight)
					{
						this.m_lstErrorResult.Add(list[0]);
					}
				}
			}
		}

		private Area m_thisArea;

		private Level m_thisLevel;

		private List<ResultBean> m_lstErrorResult = new List<ResultBean>();
	}
}
